<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ez="http://java.sun.com/jsf/composite/ezcomp"
      >
    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.Index}" />
        </ui:define>
        <ui:define name="menuitem">index.xhtml</ui:define>
        <ui:define name="body"> 
            <p:accordionPanel id="accord" multiple="true" activeIndex="0,1" >
                <p:tab title="#{bundle.History}" >
                    <h:form id="userhistory" >
                        <p:dataTable id="historylist" value="#{advertController.userhistoryadverts}" var="adv"> 
                            <p:column>
                                <ez:advertView item="#{adv}" />
                            </p:column>
                        </p:dataTable>
                        <p:commandButton icon="ui-icon-cancel" value="#{bundle.ClearHistory}"
                                         action="#{advertController.clearUserHistory()}"
                                         update=":accord:userhistory"/>
                    </h:form>
                </p:tab>
                <p:tab id="carttab" title="#{bundle.Cart}" >
                    <h:form id="usercart" >
                        <p:dataTable id="cartlist" value="#{advertController.usercartadverts}" var="adv">
                            <p:column>
                                <ez:advertView item="#{adv}"/>
                            </p:column>
                            <p:column>
                                <p:commandButton icon="ui-icon-cancel"
                                                 update=":accord:usercart"
                                                 action="#{advertController.removeAdvertFromUserCart(adv.id)}"
                                                 oncomplete="">
                                </p:commandButton>
                            </p:column>
                        </p:dataTable>
                        <p:commandButton icon="ui-icon-cancel" value="#{bundle.ClearCart}"
                                         action="#{advertController.clearUserCart()}"
                                         update=":accord:usercart"/>
                    </h:form>
                </p:tab>
            </p:accordionPanel>
        </ui:define>
    </ui:composition>
</html>